package com.by.controller.common;

import com.by.common.bean.ResultBean;
import com.by.controller.BaseController;
import com.by.service.common.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/category")
public class CategoryController extends BaseController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("/tree")
    public ResultBean queryTree(String pid) {
        List list = categoryService.queryCategoryTree(pid);
        System.out.println(pid);
        System.out.println(list);
        return success("类别树", list);
    }
}
